
package com.chkj.fbook.common.constants;

/**
 * 常量类
 */
public class Constants {

	/**
	 * 登录用户
	 */
	public final static String CURRENT_USER = "currentUser";

	public static final int BASECODE = 20000;//基准常量码

	public static final String ENV_DEVELOPMENT = "development";
	public static final String ENV_TEST        = "test";
	public static final String ENV_PRODUCTION  = "production";

	public static final int SUCCESS = 200;
	public static final String STRING_SUCCESS = "成功";

	public static final int FAILED = 500;
	public static final String STRING_FAILED = "失败";

	public static final int NOT_FIND = 404;
	public static final String STRING_NOT_FIND = "未找到响应数据";

	public static final int NULL_DATA = 1;
	public static final String STRING_NULL_DATA = "数据不能为空";

	public static final int UNAUTHED = 2;
	public static final String STRING_UNAUTHED = "需要登录";

	public static final int ILLEGAL_ACCESS = 3;
	public static final String STRING_ILLEGAL_ACCESS = "非法访问";

	public static final int PHONE_NUMBER_EXISTS = 0+BASECODE;
	public static final String STRING_PHONE_NUMBER_EXISTS = "手机号码已被注册";

	public static final int INVALIDE_CAPTCHA = 1+BASECODE;
	public static final String STRING_INVALIDE_CAPTCHA = "图形验证码不正确";

	public static final int SMS_CODE_INVALIDE = 2+BASECODE;
	public static final String STRING_SMS_CODE_INVALIDE = "短信验证码不正确";

	public static final int SMSCODE_EXPIRED = 3+BASECODE;
	public static final String STRING_SMSCODE_EXPIRED = "短信验证码不存在或已过期";

	public static final int SMSCODE_ERR_FREQUNCE = 4+BASECODE;
	public static final String STRING_SMSCODE_ERR_FREQUNCE = "未过重发时间（60s）";

	public static final int INVALIDE_USER_PASSWORD = 5+BASECODE;
	public static final String STRING_INVALIDE_USER_PASSWORD = "用户名或密码不正确";

	public static final int INVALIDE_USER_XT = 6+BASECODE;
	public static final String STRING_INVALIDE_USER_XT = "哦哦，系统崩溃了";

	public static final int INVALIDE_USER_CODE = 7+BASECODE;
	public static final String STRING_INVALIDE_USER_CODE = "用户名或验证码不能为空";

	public static final int INVALIDE_USER_PHONE = 8+BASECODE;
	public static final String STRING_INVALIDE_USER_PHONE = "请输入正确的手机号码";

	public static final int INVALIDE_NOT_EXIST_PHONE = 9+BASECODE;
	public static final String STRING_INVALIDE_NOT_EXIST_PHONE = "该手机号未注册，请注册再重新登录";

	public static final int INVALIDE_SYSTEM_ERROR = 10+BASECODE;
	public static final String STRING_INVALIDE_SYSTEM_ERROR = "系统异常";

	public static final int INVALIDE_ERR_ALIYUN_SMS = 11+BASECODE;
	public static final String STRING_INVALIDE_ERR_ALIYUN_SMS = "短信服务异常";

	/**
	 * 用户登录验证
	 */
	public static final String NOT_EXIST_LOGINNAME  = "该用户名不存在";
	public static final String LOGINNAME_OR_PASSWORD_ERROR  = "用户名或密码错误";
	public static final String SYSTEM_ERROR  = "系统异常";

	/**
	 * 短信验证码过期时间，单位：秒
	 */
	public static final int SMS_CODE_VALID_SECONDS = 300;

	/**
	 * 预约与取消预约
	 */
	public static final int ORDER_SUCCESS = 0; //预约
	public static final int ORDER_CANCEL = 1; //取消预约

	/**
	 * redis的KEY
	 */
	public static final String SMSCODE_KEY  = "SMSCODE:";
	public static final String USER_KEY = "USER:";
	public static final String ORDER_ROOM_KEY = "ORDER:ROOM:";
	public static final String ORDER_SEAT_KEY = "ORDER:SEAT:";
	public static final String EXPIRES_KEY = "EXPIRES";

    public static String getMsgConstName(int code) {
		switch (code) {
			case SUCCESS :
				return STRING_SUCCESS;
			case FAILED :
				return STRING_FAILED;
			case UNAUTHED :
				return STRING_UNAUTHED;
			case ILLEGAL_ACCESS :
				return STRING_ILLEGAL_ACCESS;
			case PHONE_NUMBER_EXISTS :
				return STRING_PHONE_NUMBER_EXISTS;
			case  INVALIDE_CAPTCHA :
				return STRING_INVALIDE_CAPTCHA;
			case SMS_CODE_INVALIDE :
				return STRING_SMS_CODE_INVALIDE;
			case SMSCODE_EXPIRED :
				return STRING_SMSCODE_EXPIRED;
			case SMSCODE_ERR_FREQUNCE :
				return STRING_SMSCODE_ERR_FREQUNCE;
			case INVALIDE_USER_PASSWORD :
				return STRING_INVALIDE_USER_PASSWORD;
			case INVALIDE_USER_XT :
				return STRING_INVALIDE_USER_XT;
			case INVALIDE_USER_CODE :
				return STRING_INVALIDE_USER_CODE;
			case INVALIDE_USER_PHONE :
				return STRING_INVALIDE_USER_PHONE;
			case INVALIDE_NOT_EXIST_PHONE :
				return STRING_INVALIDE_NOT_EXIST_PHONE;
			case INVALIDE_SYSTEM_ERROR :
				return STRING_INVALIDE_SYSTEM_ERROR;
			case INVALIDE_ERR_ALIYUN_SMS :
				return STRING_INVALIDE_ERR_ALIYUN_SMS;
			case NULL_DATA :
				return STRING_NULL_DATA;
			case NOT_FIND :
				return STRING_NOT_FIND;
			default:
				return "";
		}
	}
	
}
